﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data;
using System.Text;

namespace Hsp.Auto.Model.Models
{
    /// <summary>
    /// 表字段定义实体
    /// </summary>
    public class Columns
    {
        /// <summary>
        /// 序号
        /// </summary>
        [Display(Name = "序号")]
        public int Id { get; set; }

        /// <summary>
        /// 列名称
        /// </summary>
        [Display(Name = "列名称")]
        public string? Name { get; set; }

        /// <summary>
        /// 列说明，定义方式为：【主体：描述或定义】
        /// </summary>
        [Display(Name = "列说明")]
        public string? Comment { get; set; }

        /// <summary>
        /// 表名称
        /// </summary>
        [Display(Name = "表名称")]
        public string? TableName { get; set; }

        /// <summary>
        /// 数据类型（不能改名为【Type】）
        /// </summary>
        public string? ColumnType { get; set; }

        /// <summary>
        /// 数据类型
        /// </summary>
        [Display(Name = "数据类型")]
        public string? DataType { get; set; }

        /// <summary>
        /// 允许Null值
        /// </summary>
        [Display(Name = "允许空")]
        public int Nullable { get; set; }

        /// <summary>
        /// 可查询字段
        /// </summary>
        public int Queryable { get; set; }

        /// <summary>
        /// 是否主键
        /// </summary>
        [Display(Name = "主键")]
        public int? IsPK { get; set; }

        /// <summary>
        /// 是否标识/自增
        /// </summary>
        [Display(Name = "自增")]
        public int? IsIdentity { get; set; }

        /// <summary>
        /// ReaderType
        /// </summary>
        //public string ReaderType { get; set; }
        /// <summary>
        /// SqlDbType
        /// </summary>
        //public string SqlDbType { get; set; }

        /// <summary>
        /// 默认值
        /// </summary>
        [Display(Name = "默认值")]
        public string? DefaultValue { get; set; }

        /// <summary>
        /// 长度：字符型字段最大长度，Character_Maximum_Length
        ///  max 或特殊数据类型 使用 -1 表示！
        /// 类型“System.Decimal”的对象无法转换为类型“System.Int64”
        /// </summary>
        [Display(Name = "长度")]
        public int? Length { get; set; }

        /// <summary>
        /// 数字精度，要合并到上面“Length”中
        /// </summary>
        //public int Numeric_Precision { get; set; }

        /// <summary>
        /// 数字刻度，Numeric_Scale
        /// </summary>
        [Display(Name = "小数位数")]
        public int? Scale { get; set; }

        /// <summary>
        /// 外键表名称
        /// </summary>
        public string? Referenced_Table_Name { get; set; }

        /// <summary>
        /// 外键列名称
        /// </summary>
        public string? Referenced_Column_Name { get; set; }

    }


    /// <summary>
    /// 相似类型
    /// </summary>
    public enum LikeType
    {
        /// <summary>
        /// 数值类型
        /// </summary>
        Number,
        /// <summary>
        /// 字符类型
        /// </summary>
        String,
        /// <summary>
        /// 日期类型
        /// </summary>
        DateTime
    }
}
